import numpy as np
import pandas as pd
import seaborn as sns
from python_ai.common.xcommon import sep

sep('load titanic')
df = sns.load_dataset('titanic', cache=True)


def x_check_na_of_df(df):
    print(df.shape)
    idx = (df.isna().sum(axis=0) > 0)
    print(df.columns[idx])
    print(df[df.columns[idx]].isna().sum(axis=0))
    print(df.info())


x_check_na_of_df(df)

sep('dropna axis=0')
df_a0_dn = df.dropna(axis=0)
x_check_na_of_df(df_a0_dn)
sep('dropna axis=1')
df_a1_dn = df.dropna(axis=1)
x_check_na_of_df(df_a1_dn)
